import java.util.Scanner;

public class j2023618 {
    //创建方法求两个数的最大值max2，随后再写一个求3个数的最大值的函数max3。

    //要求：在max3这个函数中，调用max2函数，来实现3个数的最大值计算
    public  static int max(int a,int b){
        return a>b?a:b;
    }
    public static double max(double a,double b){
        return a>b?a:b;
    }
    public static double max(double a,double b,double c){
        return max(a,b)>max(b,c)?max(a,b):max(b,c);
    }
    public static int fac(int n) {
       if(n==1){
           return 1;
       }
       int ret=1;
       return ret=n*fac(n-1);
    }

    public static int add(int a,int b){
        return a+b;
    }
    public static double add(double a,double b,double c){
        return a+b+c;
    }

    public static  void  HanoiTower(char a,char b,char c,int n){
        ///a为起始柱子，b为工具柱，c为目标柱
        int count=0;
        if(n==1) {
            System.out.println(a+"->"+c);
            return ;
            //打印起始组到目标组
        }
        else {
            HanoiTower(a,c,b,n-1);
            System.out.println(a+"->"+c);
            HanoiTower(b,a,c,n-1);
        }

    }
    public static void main(String[] args) {
    /*    Scanner scanner=new Scanner(System.in);
        int n=scanner.nextInt();
        int f1=0;
        int f2=1;
        int f3=-1;
        if(n==1) {
            System.out.println(f1);
        }
        if(n==2){
            System.out.println(f2);
        }
        if(n>2){
            for (int i = 3; i <= n; i++) {
                f3 = f1 + f2;
                f1 = f2;
                f2 = f3;
            }
            System.out.println(f3);
        }*/
    /*    int a=1,b=2;
        System.out.println(add(a, b));
        double c=1.0,d=2.0,e=3.0;
        System.out.println(add(c, d, e));*/
        char a='A';
        char b='B';
        char c='C';
        Scanner scanner =new Scanner(System.in);
        int n=scanner.nextInt();
        HanoiTower(a,b,c,n);
    }
}
